home *** CD-ROM | disk | FTP | other *** search
/ Champak 114 / Vol 114.iso / games / spongebo.swf / scripts / DefineSprite_225_char / frame_1 / DoAction.as < prev   
Encoding:
Text File  |  2010-08-12  |  1.3 KB  |  62 lines

  1. onEnterFrame = function()
  2. {
  3.    scripts.charX = Math.floor(_X / tileW);
  4.    scripts.charY = Math.floor(_Y / tileH);
  5.    var _loc2_ = 0;
  6.    if(Key.isDown(37))
  7.    {
  8.       _loc2_ = 1;
  9.    }
  10.    if(Key.isDown(38))
  11.    {
  12.       _loc2_ = 2;
  13.    }
  14.    if(Key.isDown(39))
  15.    {
  16.       _loc2_ = 4;
  17.    }
  18.    if(Key.isDown(40))
  19.    {
  20.       _loc2_ = 8;
  21.    }
  22.    if(Key.isDown(32))
  23.    {
  24.       eventFire();
  25.    }
  26.    if(scripts.gameOn && scripts.attacking == false && scripts.gamePaused == false)
  27.    {
  28.       switch(_loc2_)
  29.       {
  30.          case 0:
  31.             if(char.myDir == "left")
  32.             {
  33.                this.art.gotoAndStop("ready_left");
  34.             }
  35.             if(char.myDir == "right")
  36.             {
  37.                this.art.gotoAndStop("ready_right");
  38.             }
  39.             if(char.myDir == "up")
  40.             {
  41.                this.art.gotoAndStop("ready_up");
  42.             }
  43.             if(char.myDir == "down")
  44.             {
  45.                this.art.gotoAndStop("ready_down");
  46.             }
  47.             break;
  48.          case 1:
  49.             eventLeft();
  50.             break;
  51.          case 2:
  52.             eventUp();
  53.             break;
  54.          case 4:
  55.             eventRight();
  56.             break;
  57.          case 8:
  58.             eventDown();
  59.       }
  60.    }
  61. };
  62.